<!DOCTYPE html>

<html lang="en-US">
<@common.header/>

<body class="page-sub-page page-profile page-account" id="page-top">
<!-- Wrapper -->
<div class="wrapper">
    <!-- Navigation -->
   <@common.nav/><!-- /.navigation -->
    <!-- end Navigation -->
    <!-- Page Content -->
    <div id="page-content">
        <!-- Breadcrumb -->
        <div class="container">
            <ol class="breadcrumb">
                <li><a href="#">Home</a></li>
                <li><a href="#">Account</a></li>
                <li class="active">Profile</li>
            </ol>
        </div>
        <!-- end Breadcrumb -->

         <div class="container">
            <div class="row">
            <!-- sidebar -->
            <div class="col-md-3 col-sm-2">
                <section id="sidebar">
                    <header><h3>Account</h3></header>
                    <aside>
                        <ul class="sidebar-navigation">
                            <li><a href="/page/user/profile"><i class="fa fa-user"></i><span>个人信息</span></a></li>
                            <li><a href="/house/getByUserId"><i class="fa fa-user"></i><span>我的房产</span></a></li>


                        </ul>
                    </aside>
                </section><!-- /#sidebar -->
            </div><!-- /.col-md-3 -->
            <!-- end Sidebar -->
                <!-- My Properties -->
                <div class="col-md-9 col-sm-10">
                    <section id="my-properties">
                        <header><h1></h1></header>
                        <div class="my-properties">
                            <div class="table-responsive">
                                <table class="table">
                                    <thead>
                                    <tr>
                                        <th>房产</th>
                                        <th>名称</th>
                                        <th>面积</th>
                                        <th>价格</th>
                                        <th>类型</th>
                                        <th>创建时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody id="houselist">
                                     <#list houseList as house>

                                     <tr>
                                         <td class="image">
                                             <a href="/house/detail?id=">
                                                 <img alt="" src="${house.houseImages}" style="width: 105px;height: 78px">
                                             </a>
                                         </td>

                                         <td>${house.houseName}</td>
                                         <td>${house.houseArea}m<sup>2</sup></td>
                                         <td>${house.housePrice}万</td>
                                         <td>
                                             <#if house.houseType == 1>出售</#if>
                                            <#if house.houseType == 2>出组</#if>
                                         </td>


                                         <td>${house.createTime?string('yyyy年MM月dd日 HH时mm分ss秒')}</td>
                                         <td class="actions">
                                             <input type="hidden" id="houseId" value="${house.houseId}">
                                             <a id="deleteById"><i class="delete fa fa-trash-o"></i></a>
                                         </td>
                                     </tr>

                                     </#list>
                                </tbody>
                              </table>
                         </div><!-- /.table-responsive -->
                            <!-- Pagination -->
                            <div class="center">

                            </div><!-- /.center-->
                        </div><!-- /.my-properties -->
                    </section><!-- /#my-properties -->
                </div><!-- /.col-md-9 -->
                <!-- end My Properties -->
            </div><!-- /.row -->
        </div><!-- /.container -->
    </div>
    <!-- end Page Content -->
    <!-- Page Footer -->

    <!-- end Page Footer -->
</div>

<@common.js/>
<!--[if gt IE 8]>
<script type="text/javascript" src="assets/js/ie.js"></script>
<![endif]-->
 <script  type="text/javascript" >
     

     $(document).ready(function() {
          $("#houselist").on('click', '#deleteById', function () {
              var houseId = $(this).prevAll("#houseId").val();
              $.ajax({
                  url:'/house/deleteByHouseId?houseId='+houseId,
                  success:function (result) {
                      if (result.status=200) {
                          window.location.reload();
                      } else {
                          alert(result.msg);
                          return false;
                      }
                  }
              })
          })
        })
        
 </script>
</body>
</html>